﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;

namespace Medicine.Models
{
    public class MedicineAdapter : BAdapter<Medicine>
    {

        public MedicineAdapter()
            : base()
        {
        }
        public MedicineAdapter(Activity context)
            : base(context)
        {
        }

        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var item = base._data[position];
            View view = convertView;
            if (view == null)
                view = base._context.LayoutInflater.Inflate(Resource.Layout.CustomListViewLayout, null);
            view.FindViewById<TextView>(Resource.Id.textView1).Text = item.MedicineName;
            view.FindViewById<TextView>(Resource.Id.textView2).Text = item.ExpirationDate.ToString("yyyy-MM-dd");
            return view;
        }
    }
}